home *** CD-ROM | disk | FTP | other *** search
/ Enciclopedia Del Perro / Enciclopedia Del Perro.iso / info31 / simple5.scr < prev    next >
Text File  |  1994-06-20  |  4KB  |  111 lines

  1. <******************************************************* language=slang
  2.  
  3. Sample SLANG Modem Dialup Script
  4.  
  5. Description:
  6.  
  7.     Simple Example #5 -- Written in the SLANG scripting language
  8.  
  9.     This script dials the modem.  It then checks "polls" the
  10.     serial line to see if the modem has connected with the remote
  11.     modem.
  12.  
  13.     If the connection has been made the script enters a user-id
  14.     after a short delay, then a password after another short
  15.     delay and, finally, packet mode is enabled so enable TCP/IP
  16.     data transfers.  The last thing the script does is run two
  17.     DOS applications:  PCMAIL and VMAIL.  VMAIL is left running
  18.     after the script is done.
  19.  
  20.     If no connetion is made the script informs the user and ends.
  21.  
  22.     This script does not store a user id or password directly,
  23.     but uses the ones that were entered in WDial's Configuration
  24.     Window.
  25.  
  26. To Use This Script:
  27.  
  28.     Change "0000" to the phone number of the remote machine you
  29.     would like to connect to.
  30.  
  31.     Be sure the enter your password and user id in WDial's
  32.     Configuration Window.
  33.  
  34.     Adjust the intervals in the (pause,...) functions to suit
  35.     your needs.  These are in milliseconds (5000 milliseconds ==
  36.     5 seconds).
  37.  
  38.     This script assumes that your modem, and the remote host,
  39.     terminate commands with an ASCII Carrage-Return character.
  40.     If, instead, a Carrage-Return/Line-Feed (CRLF) is required,
  41.     change "(cr)" to "(cr)(lf)" everywhere in the script it is
  42.     necessary.
  43.  
  44. Notes:
  45.  
  46.     This is a very simple dial script.  It assumes that, once the
  47.     modem connection has been made the following will be true:
  48.  
  49.     o    the remote machine will always be ready for your
  50.         user-id after a set interval
  51.  
  52.     o    like-wise for your password
  53.  
  54.     It is more robust than simpler examples in that it checks to
  55.     see if the modem connected or not, and acts accordingly.
  56.     There is no provision for retries, or verification of the
  57.     remote host, all of which are possible in SLANG.  The script
  58.     also assumes that there will be a user id and password prompt
  59.     after set intervals.
  60.  
  61. Built-In SLANG Functions Used:
  62.  
  63.     send        Send a character string to the modem.
  64.     cr        Return a Carriage-Return character.
  65.     poll        Wait for the serial line to change state.
  66.     pause        Wait a specified number of milliseconds.
  67.     username    Return username from WDial's Configuration Window.
  68.     password    Return password from WDial's Configuration Window.
  69.     shell        Run a program, wait until program is done running.
  70.     start        Run a program, don't wait for it to complete.
  71.     changemode    Changes mode of connection from "raw" to
  72.             "packet".
  73.  
  74. ************************************************************************>
  75.  
  76. (send,                <* Dial the remote modem/host        *>
  77.     {ATDT0000}        <*    Modem command and phone number    *>
  78.     (cr)            <*    Carrage-Return after modem cmd    *>
  79. )                <*    End of "send" function        *>
  80.  
  81. (poll, physical, open, 30000,    <* Wait for the modem to connect    *>
  82.   {                <* IF THE MODEM CONNECTED SUCESSFULLY   *>
  83.     (pause, 3000)        <*  Wait for remote machine's prompt    *>
  84.                 <*  Log-in to the remote modem/host    *>
  85.     (send, (username) )        <*    Send your user id        *>
  86.     (send, (cr) )        <*    Carrage-Return after user id    *>
  87.     (pause, 5000)        <*  Wait for a password prompt        *>
  88.                 <*  Send the password            *>
  89.     (send, (password) )        <*    Send password            *>
  90.     (send, (cr) )        <*    Carrage-Return after password    *>
  91.     (pause, 5000)        <*  Pause for a moment            *>
  92.     (changemode, packet)    <*  Change to "packet" mode        *>
  93.  
  94.     (shell, pcmail)        <*  Run mailer                *>
  95.     (start, vmail)        <*  Run mail reader            *>
  96.  
  97.   }                <* END IF THE MODEM CONNECTED        *>
  98.  
  99.   ,                <* Comma delimits "Else" part of "poll" *>
  100.  
  101.   {                <* ELSE IF THE MODEM DOSN'T CONNECT    *>
  102.     (output,
  103.              {
  104.  
  105.         The Modem didn't connect.  End of Script.
  106.  
  107. }                <*  everything between { } is displayed    *>
  108.     )                <* End of the "output" function        *>
  109.   }                <* END IF THE MODEM DOESN'T CONNECT    *>
  110. )                <* End of the "poll" function        *>
  111.